<include file="Public:header" />
<!--主体内容-->
<!--左边-->
<div class="centent_box">
    <include file="Public:left" />
    <!--右边-->
    <div class="centent_right_box">
        <div class="centent_right rightCon">
            <div class="Mtitle">
                <ul>
                    <li class="on"><span>发布出租</span></li>
                </ul>
                <div class="rightWord"><a href="{:U('Rental/index')}">出租管理</a> &gt;&gt; 发布出租</div>
            </div>
            <form id="info_form" action="{:U('Rental/add')}" method="post" enctype="multipart/form-data">
            <div class="con_div">
                <ul class="formList width2 list_ul list_mp">
                    <li>
                        <label>房源名称：</label>
                        <input type="text"  name="data[title]" id="title" class="inputStyle width3">
                    </li>
                    <li>
                        <label>所属地区：</label>
                        <select name="data[area_id]" id="area_id" class="selectStyle">
                            <option value="0">--请选择--</option>
                            <volist name="cate_list" id='vo'>
                                <option value="{$vo.id}">{$vo.html}{$vo.name}</option>
                            </volist>
                        </select>
                        <label class="label1">所属小区：</label>
                        <select name="data[estate_id]" id="estate_id" class="selectStyle">
                            <option value="0">--请选择小区--</option>
                        </select>
                    </li>
                    <li>
                        <label>户型：</label>
                        <select name="data[room]"  class="selectStyle select1">
                            <option value="0">--室--</option>
                            <volist name="menu[24]" id="vo">
                                <option value="{$vo.parameter}">{$vo.name}</option>
                            </volist>
                        </select>
                        <select name="data[hall]"  class="selectStyle select1">
                            <option value="0">--厅--</option>
                            <volist name="menu[24]" id="vo">
                                <option value="{$vo.parameter}">{$vo.name}厅</option>
                            </volist>
                        </select>
                        <select name="data[kitchen]"  class="selectStyle select1">
                            <option value="0">--卫--</option>
                            <volist name="menu[24]" id="vo">
                                <option value="{$vo.parameter}">{$vo.name}卫</option>
                            </volist>
                        </select>
                        <select name="data[toilet]"  class="selectStyle select1">
                            <option value="0">--厨--</option>
                            <volist name="menu[24]" id="vo">
                                <option value="{$vo.parameter}">{$vo.name}厨</option>
                            </volist>
                        </select>
                        <select name="data[balcony]"  class="selectStyle select1">
                            <option value="0">--阳台--</option>
                            <volist name="menu[24]" id="vo">
                                <option value="{$vo.parameter}">{$vo.name}阳台</option>
                            </volist>
                        </select>
                    </li>
                    <li>
                        <label>面积：</label>
                        <input type="text" class="inputStyle width2" name="data[area]" maxlength="10">
                        <span class="tip">必填写项</span>
                    </li>
                    <li>
                        <label>楼层：</label>
                        <input type="text" class="inputStyle width2" name="data[floor]" maxlength="10">
                        <span class="tip">共</span>
                        <input type="text" class="inputStyle width2" name="data[total_floor]" maxlength="10">
                        <span class="tip">层</span>
                    </li>
                    <li>
                        <label>月租价：</label>
                        <input type="text" class="inputStyle width2" name="data[price]" maxlength="10">
                        <span class="tip">元</span>
                        <label class="label1">押金：</label>
                        <input type="text" class="inputStyle width2" name="data[deposit]" maxlength="10">
                        <span class="tip">元</span>
                    </li>
                    <li class="li_checkbox" id="house_type"><label class="lw90">楼盘类型：</label>{:getLinkMenu(2,'house_type','checkbox')}</li>
                    <li class="li_radio"><label class="lw90">装修情况：</label>{:getLinkMenu(10,'renovation_type','radio')}</li>
                    <li class="li_radio"><label class="lw90">朝向：</label>{:getLinkMenu(17,'orientations','radio')}</li>
                    <li class="li_checkbox"><label class="lw90">房屋配套：</label>{:getLinkMenu(20,'mating','checkbox')}</li>
                    <li class="li_radio"><label class="lw90">地铁：</label>{:getLinkMenu(8,'metro','radio')}</li>
                    <li>
                        <label>出租方式：</label>
                        <select name="data[rental_mode]" class="selectStyle">
                             <volist name="menu[26]" id='vo'>
                                <option value="{$vo.id}">{$vo.name}</option>
                            </volist>
                        </select>
                        <label class="label1">支付方式：</label>
                        <select name="data[pay_type]" class="selectStyle">
                        <volist name="menu[25]" id='vo'>
                            <option value="{$vo.id}">{$vo.name}</option>
                        </volist>
                        </select>
                    </li>
                    <li>
                        <label>建筑年代：</label>
                        <input type="text" class="inputStyle width2" name="data[years]" maxlength="10">
                        <span class="tip">年</span>
                    </li>
                    <li>
                        <label>所在地址：</label>
                        <input type="text" class="inputStyle width3" name="data[address]">
                        <span class="tip">中文字符</span>
                    </li>
                    <li>
                        <label>地图标注：</label>
                        <input type="text" class="inputStyle" name="data[map]">
                        <span class="tip"><a target="_blank" style="padding: 4px 8px;color:#ffffff;background: orange" href="http://api.map.baidu.com/lbsapi/getpoint/">获取百度地图坐标</a></span>
                    </li>
                    <li id="files">
                        <label>多图上传：</label>
                        <script id="uploadpic" name="uploadpic" type="text/plain"></script>
                        <input type="button" class="btn btn_submit" style="margin:0 0 10px 10px;" onclick="upImage();" value="选择图片">
                        <div id="imageList">
                            <ul class="list clearfix"></ul>
                        </div>
                        <input type="hidden" name="file" id="file" />
                    </li>
                    <li><label>缩例图：</label><input type="file" name="img"></li>
                    <li class="height1"><label>特色标签：</label><textarea class="textarea" style="width: 550px;float: left" id="tags" name="data[tags]"></textarea><span class="tip">多个使用,号隔开</span></li>
                    <li style="margin-bottom: 5px;"><label>房源介绍：</label><label style="width: 400px;"><input type="checkbox" name="pic" value="1"> 使用内容第一张图片做为缩例图</label></li>
                    <li class="height2">
                        <textarea name="data[info]" id="info" style="width:850px;height:500px;resize: none;float:left"></textarea>
                    </li>
                    <li>
                        <label>联系人 ：</label>
                        <input type="text" class="inputStyle width1" name="data[contacts]">
                        <span class="tip">必填项</span>
                    </li>
                    <li>
                        <label>联系电话：</label>
                        <input type="text" class="inputStyle width1" name="data[phone]">
                        <span class="tip">必填项</span>
                    </li>
                    <li>
                        <label>急租房源：</label>
                        <select name="data[is_emergency]" class="selectStyle">
                            <option value="1">是</option>
                            <option value="0">否</option>
                        </select>
                        <label class="label1">房源来源：</label>
                        <select name="data[source]" class="selectStyle">
                            <option value="1">个人房源</option>
                            <option value="2">中介房源</option>
                        </select>
                    </li>
                    <li>
                        <label>出租状态：</label>
                        <select class="selectStyle" name="data[status]">
                            <option value="1">发布出租</option>
                            <option value="5">存为手稿</option>
                        </select>
                    </li>
                    <li>
                        <label></label>
                        <input type="submit" value="提 交" class="btnStyle">
                    </li>
                </ul>
            </div>
            </form>
        </div>
    </div>
</div>
<js file="__S__/ueditor/ueditor.config.js" charset="utf-8" />
<js file="__S__/ueditor/ueditor.all.min.js" charset="utf-8" />
<js file="__S__/ueditor/lang/zh-cn/zh-cn.js" charset="utf-8" />
<js file="__JS__/uploadImg.js" charset="utf-8" />
<script type="text/javascript">
    window.UEDITOR_HOME_URL='__STATIC__/ueditor/';
    window.onload=function(){
        window.UEDITOR_CONFIG.initialFrameWidth=880;
        window.UEDITOR_CONFIG.initialFrameHeight=500;
        upmoreimg();
    }
    var ue = UE.getEditor('info', {
        toolbars: [[
            'fullscreen', 'source', '|',
            'bold', 'italic', 'underline', '|', 'fontfamily','fontsize', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', 'simpleupload','|', 'kityformula', 'preview'
        ]]
    });
</script>
<script src="__S__/js/jquery.validate.js"></script>
<script type="text/javascript">
    $(function(){
        $("#info_form").validate({
            rules: {
                "data[title]": {
                    required: true,
                    minlength: 2
                },
                "data[area_id]": {
                    area:true
                },
                "data[area]": {
                    required: true,
                    minlength: 2
                },
                "data[floor]": {
                    required: true
                },
                "data[price]": {
                    required: true
                },
                "house_type[]": {
                    required: true,
                    minlength: 2
                },
                "data[years]": {
                    required: true,
                    minlength: 4
                },
                "data[address]": {
                    required: true,
                    minlength: 5
                },
                "data[map]": {
                    required: true,
                    minlength: 10
                },
                "data[contacts]":{
                    required: true
                },
                "data[phone]":{
                    required: true
                }

            },
            messages: {
                "data[title]": {
                    required: "请输入房源名称",
                    minlength: "房源名称一定要两个字以上"
                },
                "data[area]": {
                    required: "请输入房源面积",
                    minlength: "房源面积一定要两个字以上"
                },
                "data[floor]": {
                    required: "请填写所在楼层"
                },
                "data[price]": {
                    required: "请填写月租金额"
                },
                "house_type[]": {
                    required: "楼盘类型一定要选择",
                    minlength: "楼盘类型选择两种以上"
                },
                "data[years]": {
                    required: "请填写房源年份",
                    minlength: "请输入正确的房源年份"
                },
                "data[address]": {
                    required: "请填写房源所在地址",
                    minlength: "房源所在地址请写详细点"
                },
                "data[map]": {
                    required: "输入房源百度地图坐标",
                    minlength: "请输入正确的房源地图坐标"
                },
                "data[contacts]": {
                    required: "输入租房联系人"
                },
                "data[phone]": {
                    required: "请输入联系电话"
                }
            }
        });

        //所属地区
        $.validator.addMethod("area", function(value, element) {
           if($("#area_id").val()!=0){
               return true
           }else{
               return false
           }
        }, "请选择所属地区");
    });

    $("#area_id").change(function(){
        var v = $(this).val();
        if(v!=0){
            $.ajax({
                type: "post",
                url : "{:U('Ajax/getEstate')}",
                dataType:'json',
                data:{area_id:v},
                success: function(json){
                    var html = " <option value='0'>--请选择小区--</option>";
                    if(json.status==1){
                     var data = json.data;
                    $.each(data,function (k,v){
                       html +=  " <option value='"+v.id+"'>"+ v.title+"</option>";
                     });
                    }else{
                       alert('找不到对应的小区信息');
                    }
                    $("#estate_id").empty();
                    $("#estate_id").append(html);
                }
            });
        }
    });
</script>
<include file="Public:footer" />